def id_rule(id):
    id1 = set('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHYJKLMNOPQRSTUVWXYZ_')
    if len(id) < 9:
        if set(id).issubset(id1):
            return True
    return False

def email_rule(email):
    if '@' and '.' in email:
        return True
    return False

def id_card_rule(id_card):
    if len(id_card) == 18:
        if id_card[:17].isdigit():
            if id_card[17:].isdigit() or id_card[17:] == 'x':
                return True
    return False

def name_rule(name):
    if len(name) < 5:
        for c in name:
            if c < '\u4e00' or c > '\u9fff':
                return False
        return True
    return False

id = None
EMAIL = None
id_card = None
name = None
while True:
    id = input('请输入ID:')
    if id_rule(id):
        break
while True:
    email = input('请输入EMAIL地址:')
    if email_rule(email):
        break
while True:
    id_card = input('请输入身份证号:')
    if id_card_rule(id_card):
        break
while True:
    name = input('请输入姓名:')
    if name_rule(name):
        break
print('id : {}'.format(id))
print('EMAIL地址 : {}'.format(email))
print('身份证号 : {}'.format(id_card))
print('姓名 : {}'.format(name))
print('性别 : {}'.format('男' if int(id_card[-2]) % 2 == 1 else '女'))

